<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改【请填写功能名称】')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-travelrequest-edit" th:object="${veTravelrequest}">
            <input name="RequestID" th:field="*{RequestID}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label">驾驶员：</label>
                <div class="col-sm-8">
                    <select name="DriverID" class="form-control m-b" th:with="type=${@veDriversServiceImpl.getVeDriversList()}">
                        <option th:each="driver : ${type}" th:text="${driver.driverName}" th:value="${driver.driverID}" th:field="*{DriverID}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">车名：</label>
                <div class="col-sm-8">
                    <select name="VehicleID" class="form-control m-b" th:with="type=${@veVehiclesServiceImpl.getVeVehiclesList()}">
                        <option th:each="vehicle : ${type}" th:text="${vehicle.vehicleName}" th:value="${vehicle.vehicleID}" th:field="*{VehicleID}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">出发地点：</label>
                <div class="col-sm-8">
                    <select name="DepartureLoc" class="form-control m-b" th:with="type=${@veStationinfoServiceImpl.getVeStationinfoList()}">
                        <option th:each="station : ${type}" th:text="${station.Address}" th:value="${station.StationID}" th:field="*{DepartureLoc}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">目的地：</label>
                <div class="col-sm-8">
                    <select name="Destination" class="form-control m-b" th:with="type=${@veStationinfoServiceImpl.getVeStationinfoList()}">
                        <option th:each="station : ${type}" th:text="${station.Address}" th:value="${station.StationID}" th:field="*{Destination}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">出发日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="DepartDate" th:value="${#dates.format(veTravelrequest.DepartDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">预计返回日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="ExpectedReturnDate" th:value="${#dates.format(veTravelrequest.ExpectedReturnDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">出差目的：</label>
                <div class="col-sm-8">
                    <input name="Purpose" th:field="*{Purpose}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">申请状态：</label>
                <div class="col-sm-8">
                    <select name="Status" class="form-control m-b"
                            th:with="type=${@dict.getType('sys_travel_status')}" th:field="*{Status}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="Notes" class="form-control">[[*{Notes}]]</textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/travelrequest";
        $("#form-travelrequest-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-travelrequest-edit').serialize());
            }
        }

        $("input[name='DepartDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='ExpectedReturnDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>